<?php

require_once(SITE_MODULES_DIR . '/calendarhub/CalendarhubWebModule.php');

class SchoolcalendarhubWebModule extends CalendarhubWebModule {

    /*protected function initialize() {
        if (!$this->isLoggedIn() || $this->getUser()->getAuthenticationAuthorityIndex() <> 'eip')
            $this->unauthorizedAccess();

        parent::initialize();
    }*/

    protected function initializeForPage() {
        $user = $this->getUser();

        if (!$this->isLoggedIn() || ($user->getAuthenticationAuthorityIndex() <> 'eip' && $user->getAuthenticationAuthorityIndex() <> 'eip_parent'))
            $this->unauthorizedAccess();

        $unitid = $user->getAttribute('unitid');

        $myCalendars = array();
        $myCalendars[] = array(
            'title' => $user->getAttribute('unit'),
            'url'   => $this->buildBreadcrumbURL('day', array(
                'type'     => 'static',
                'calendar' => $unitid
            )),
        );
        $this->assign('myCalendars', $myCalendars);

        parent::initializeForPage();
    }

}
